We phrase parsing with context-free expressions as a type inhabitationproblem where values are parse trees and types are context-free expressions. Wefirst show how containment among context-free and regular expressions can bereduced to a reachability problem by using a canonical representation ofstates. The proofs-as-programs principle yields a computational interpretationof the reachability problem in terms of a coercion that transforms the parsetree for a context-free expression into a parse tree for a regular expression.It also yields a partial coercion from regular parse trees to context-freeones. The partial coercion from the trivial language of all words to acontext-free expression corresponds to a predictive parser for the expression.
展开▼